trigger DeletePEMRecord on PE_Sample_Management__c(before delete) {
    Profile p  = [select id from profile where name=: 'System Administrator' or name =: '系统管理员'];
    if(system.trigger.isdelete){
        List<ID> Ids = new List<ID>();
        if(system.trigger.isdelete){
             for (PE_Sample_Management__c srb: Trigger.old)
             {
                 if((!srb.Deal__c)||(p.id == UserInfo.getProfileId()))
                     Ids.add(srb.id);
                 else
                     srb.addError('该记录不能被删除!');
             }
             List<RegionalBudget__c> RBList = [Select id From RegionalBudget__c Where PESampleManagement__c in:Ids];
             Delete RBList;
        }
    }
}